package com.xiyu.service.repository.customer.info;

import com.xiyu.service.model.customer.info.CustomerWebsite;
import com.xiyu.service.model.customer.info.CustomerWebsiteTable;
import org.babyfish.jimmer.spring.repository.JRepository;

import java.util.List;

public interface CustomerWebsiteRepository extends JRepository<CustomerWebsite, Long> {
    CustomerWebsiteTable customerWebsiteTable = CustomerWebsiteTable.$;

    default void deleteByExcludeId(Long customerId, List<Long> ids){
        sql().createDelete(customerWebsiteTable)
                .where(customerWebsiteTable.customerId().eq(customerId))
                .where(customerWebsiteTable.id().notIn(ids))
                .execute();
    }

    List<CustomerWebsite> findByCustomerId(Long customerId);

}